/**
 * 
 */
package org.wolf.common.config;

import java.io.Serializable;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;

/**
 * @author 何小锋
 * 
 */
@XmlType
@XmlAccessorType(XmlAccessType.NONE)
public class WebCfg implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@XmlAttribute
	private String id;
	@XmlAttribute
	private Integer port = 8081;
	@XmlAttribute
	private Integer processorCount = 0;
	@XmlAttribute
	private Integer workThreads = 100;
	@XmlAttribute
	private Integer backLog = 2000;
	@XmlAttribute
	private String logLevel;
	@XmlElementWrapper(name = "services")
	@XmlElement(name = "service")
	private List<WebServiceCfg> webServices;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Integer getPort() {
		if (port == null || port <= 0)
			port = 8081;
		return port;
	}

	public void setPort(Integer port) {
		this.port = port;
	}

	public Integer getProcessorCount() {
		if (processorCount == null || processorCount < 0)
			processorCount = 0;
		return processorCount;
	}

	public void setProcessorCount(Integer processorCount) {
		this.processorCount = processorCount;
	}

	public Integer getWorkThreads() {
		if (workThreads == null || workThreads <= 0)
			workThreads = 100;
		return workThreads;
	}

	public void setWorkThreads(Integer workThreads) {
		this.workThreads = workThreads;
	}

	public Integer getBackLog() {
		if (backLog == null || backLog <= 0)
			backLog = 2000;
		return backLog;
	}

	public void setBackLog(Integer backLog) {
		this.backLog = backLog;
	}

	public String getLogLevel() {
		return logLevel;
	}

	public void setLogLevel(String logLevel) {
		this.logLevel = logLevel;
	}

	public List<WebServiceCfg> getWebServices() {
		return webServices;
	}

	public void setWebServices(List<WebServiceCfg> webServices) {
		this.webServices = webServices;
	}

}
